Skip to main content

Scalable perpetual and options cLOB based design (1)

Aethelred Derivatives Exchange (ADEX) is a decentralized protocol designed to be deployed on the RISEChain, offering a high-performance, scalable Central Limit Order Book (CLOB) for trading perpetual swaps and options. A core innovation of ADEX is the integration of Liquidity Provider (LP) vaults that underwrite options listed on the CLOB, with automated delta hedging mechanisms utilizing the ADEX perpetuals CLOB itself. This creates a capital-efficient, symbiotic ecosystem for sophisticated derivatives trading and liquidity provision.

Core Objectives

  • Scalability & Performance: Leverage RISEChain's high TPS and low latency to provide a CEX-like trading experience for CLOB-based derivatives.
  • Capital Efficiency: Implement advanced portfolio margining and allow LPs to hedge efficiently, reducing overall collateral requirements.
  • Comprehensive Derivatives Offering: Provide both perpetual swaps and options on a unified platform.
  • Robust Risk Management: Implement sophisticated margin, liquidation, and insurance fund mechanisms.
  • Decentralization & Transparency: Maintain core settlement and fund custody on-chain while optimizing for performance with off-chain components.
  • Innovative LP Solutions: Enable users to earn yield by underwriting options with integrated risk mitigation (hedging).

Target Audience

Professional & Algorithmic Traders: Seeking deep liquidity, fast execution, and CLOB functionality for perps and options. Retail Derivatives Traders: Looking for accessible yet sophisticated derivatives products. Liquidity Providers / Yield Seekers: Wanting to earn premiums by underwriting options with managed risk. Hedgers: Entities looking to hedge exposure from other crypto or traditional market activities. Market Makers: Providing liquidity to the CLOB for both perpetuals and options.


Key Features

  • High-performance CLOB for perpetuals (e.g., BTC-PERP, ETH-PERP, RISE-PERP).
  • CLOB for European-style, cash-settled options on various underlyings.
  • LP Vaults for underwriting (selling) options.
  • Automated delta hedging for LP Vaults using ADEX perpetuals.
  • Advanced Portfolio Margining system.
  • Low-latency order placement, cancellation, and matching (via off-chain engine).
  • Fast and secure on-chain settlement on RISEChain.
  • Robust liquidation engine and insurance fund.

On-Chain Components (RISEChain)

  • ClearingHouse: Core contract managing user accounts, collateral, margin calculations, trade settlements, and interactions with other modules.
  • PositionLedger: Stores and updates user and LP vault positions for both perpetuals and options.
  • OrderBookExecutor: Receives batches of matched trades from the off-chain Matching Engine and validates/executes them on-chain.
  • FundingOracle: Calculates and stores funding rates for perpetuals.
  • PriceOracleAggregator: Securely aggregates prices from multiple oracle providers for index prices (perps) and volatility data (options).
  • InsuranceFund: Holds funds to cover bankrupt positions.
  • OptionsRegistry: Manages the lifecycle of tradable option series (creation, expiry).
  • LPVaultManager: Manages LP deposits, withdrawals, coordinates underwriting strategies, and interfaces with hedging mechanisms.
  • Governance: Manages protocol parameters and upgrades.

Off-Chain Components

  • Matching Engine (will be decentralized and Onchain in future releases): High-speed engine that receives orders, maintains the CLOB for both perps and options, and matches trades.
  • Liquidation Bots: Monitor user and LP vault positions for under-margination and trigger liquidations.
  • Price Feed Providers & Oracle Network Nodes: Supply real-time price data to the on-chain PriceOracleAggregator.
  • API Gateway & User Interface (UI): Provide interfaces for users and programmatic traders.
  • Indexer & Historical Data Service: Provides historical trade data, funding rates, etc.
  • LP Vault Hedging Bots: Execute delta hedging strategies for LP Vaults by placing orders on the ADEX perpetuals CLOB.

  • Trade Execution: User submits order via API/UI -> Matching Engine matches -> Matched trade sent to OrderBookExecutor -> ClearingHouse settles trade, updates PositionLedger & margins.
  • LP Underwriting & Hedging: LP deposits to LPVaultManager -> LPVaultManager (via Hedging Bot) sells option on Options CLOB -> Hedging Bot places delta hedge on Perpetuals CLOB.
  • Liquidation: Liquidation Bot detects under-margined position -> Triggers liquidation via ClearingHouse -> Position taken over by liquidator or Insurance Fund.

Core Mechanics & Concepts

  • Index Price (P_idx): Volume-weighted average price of the underlying asset from multiple reputable spot exchanges. Provided by PriceOracleAggregator. Used for funding rate calculation and settlement at expiry (though perps don't expire, this is relevant for options on perps or similar).

  • Mark Price (P_mark): Price used for calculating Unrealized PnL and margin requirements. Designed to be manipulation-resistant. Typically a combination of:

    P_mark = Median(P_idx, Last Traded Price on ADEX, Moving Average of Order Book Mid-Price)

    Or more robustly: P_mark = P_idx + Basis_EMA where Basis_EMA is an exponential moving average of (ADEX_Impact_Mid_Price - P_idx).

  • Last Traded Price (P_last): The price of the most recent trade on ADEX for that perpetual market.

Funding Rate Mechanism

  • Periodic payments exchanged between long and short position holders to keep the perpetual's mark price anchored to the index price.

  • Funding Interval: E.g., every 1 hour or 8 hours.

  • Funding Rate (FR): Calculated based on the premium/discount of the perpetual's price relative to the index price, and potentially an interest rate component.

    Premium = (Impact Mid Price of Perp on ADEX - P_idx) / P_idx

    FR = clamp(Average Premium over Funding Period, -max_funding_rate, +max_funding_rate) + Interest Rate Component

    • If FR > 0: Longs pay shorts.
    • If FR < 0: Shorts pay longs.
  • Payment: Funding Payment = Position Size (in underlying) * FR (or Position Value * FR).

  • Calculated by FundingOracle and applied by ClearingHouse

Margin & Leverage

  • Portfolio Margin: ADEX will strive to implement a sophisticated portfolio margining system. Instead of margining each position in isolation, the system evaluates the total risk of a user's entire portfolio (including perpetuals and options). This is significantly more capital-efficient.
    • This can be achieved using methodologies like Standard Portfolio Analysis of Risk (SPAN) or Value at Risk (VaR) models.
    • Required Portfolio Margin = RiskFunction(User's Entire Portfolio, Current Market Conditions, Volatility Scenarios)
  • Initial Margin (IM): Minimum collateral required to open a position.
  • Maintenance Margin (MM): Minimum collateral required to keep a position open. If Account Collateral < MM_Portfolio, liquidation is triggered.
  • Leverage: Implicitly determined by the margin requirements. E.g., Effective Leverage = Position Value / Account Collateral.
  • Collateral: Supports RISE, stablecoins, and potentially other high-quality crypto assets. Haircuts applied to non-stablecoin collateral.

Liquidation Engine

  • Triggered when Account Equity < Required Maintenance Margin_Portfolio.
  • Process:
    1. Liquidation Bots detect eligible accounts.
    2. Bots submit liquidation requests to ClearingHouse.
    3. ClearingHouse attempts to close/reduce the position by submitting orders to the ADEX CLOB at prevailing market prices (or slightly better to incentivize liquidators).
    4. A liquidation penalty fee is charged, part goes to the liquidator, part to the Insurance Fund.
    5. If the position cannot be closed orderly on the CLOB (market too volatile, insufficient liquidity), the Insurance Fund steps in.
    6. If the Insurance Fund is depleted, Auto-Deleveraging (ADL) may occur as a last resort, where profitable opposing positions are force-closed.

Insurance Fund

  • A pool of capital to cover losses from bankrupt positions (when a liquidated position's collateral is insufficient to cover its losses).
  • Funded by:
    • A portion of liquidation penalty fees.
    • A portion of trading fees.
    • Direct contributions (governance decision).
  • If the fund runs low, it may be recapitalized through various mechanisms (e.g., protocol revenue allocation, token sales).

Trading Fees

  • Maker-taker fee model to incentivize liquidity provision on the CLOB.
  • Taker Fee > Maker Fee.
  • Fees can be tiered based on trading volume or stake of ADEX governance token.
  • A portion of fees contributes to the Insurance Fund and protocol treasury.

Option Contract Specifications (European, Cash-Settled)

ADEX will initially support standard European-style options, which can only be exercised at expiry. All options will be cash-settled against the underlying asset's Index Price at the moment of expiry.

  • Underlying Assets: Initially major crypto assets with reliable price feeds (e.g., BTC, ETH, RISE). Expandable via governance.
  • Option Type: Call (right to buy) and Put (right to sell).
  • Strike Price (K): The price at which the option holder can buy (call) or sell (put) the underlying asset at expiry. A range of strike prices will be listed for each underlying and expiry.
  • Expiry Date (T): The specific date and time when the option contract expires and can be exercised. ADEX will support various expiries (e.g., daily, weekly, monthly, quarterly).
  • Contract Size: Each option contract will represent a standardized amount of the underlying asset (e.g., 1 option contract = 0.1 BTC).
  • Premium: The price of the option contract, paid by the buyer to the seller (underwriter), determined on the ADEX Options CLOB.
  • Settlement Method: Cash settlement.
    • Call Option Payout at Expiry: max(0, Index Price at Expiry - Strike Price) * Contract Size

    • Put Option Payout at Expiry: max(0, Strike Price - Index Price at Expiry) * Contract Size

      The payout is credited/debited to the respective parties' ADEX collateral balances.


Core Mechanics & Concepts: LP Underwriting & Hedging

LP Vaults for Options Underwriting

  • The LPVaultManager.sol contract will allow users to deposit collateral (e.g., stablecoins, RISE) into specific LP Vaults.
  • Each vault can be configured with a specific underwriting strategy, e.g.:
    • "BTC Weekly Call Writing Vault - 10% OTM"
    • "ETH Monthly Put Writing Vault - ATM"
  • LPs deposit collateral and receive LP tokens representing their share of the vault.
  • The vault, managed by automated strategies (potentially influenced by off-chain bots or DAO-approved strategies), will then sell (underwrite) corresponding options on the ADEX Options CLOB.
    • Example: The BTC Call Writing Vault will place sell orders for specific BTC call option series.

Automated Delta Hedging on ADEX Perpetuals CLOB

  • Objective: To keep the LP Vaults delta-neutral (or close to it), reducing their directional risk from the underwritten options.
  • Mechanism:
    1. When an LP Vault sells an option (e.g., sells a BTC call), it becomes short delta.
    2. An associated, authorized LP Vault Hedging Bot (off-chain) monitors the vault's aggregate options position and its net delta.
    3. The Hedging Bot automatically places orders on the ADEX Perpetuals CLOB to counteract this delta.
      • If the vault sold calls (short delta), the bot buys the underlying perpetual (e.g., BTC-PERP) to achieve a net delta closer to zero.
      • If the vault sold puts (long delta), the bot sells the underlying perpetual.
    4. The perpetual positions taken for hedging are held by the LP Vault itself and are part of its portfolio margin calculation.
  • Rebalancing: The delta of options changes as the underlying price and time to expiry change (gamma, theta effects). The Hedging Bot will continuously monitor and rebalance the perpetual hedge as needed.
  • Capital Efficiency: Hedging on the same platform's perpetuals market where the LP Vault's collateral is held streamlines the process and leverages the cross-margining benefits.

CONTRACTS

ClearingHouse.sol (Core Logic, Margin, Settlement)

  • Purpose: The central nervous system. Manages user collateral accounts, portfolio margin calculations, trade settlement logic (interfacing with OrderBookExecutor), position PnL updates, and fund transfers.
  • Key State: User collateral balances, margin parameters, market configurations.
  • Key Functions: depositCollateral(), withdrawCollateral(), processMatchedTrades(), updateMargin(), liquidatePosition(), settleExpiredOption(), applyFundingPayment().

PositionLedger.sol (Tracks User & LP Vault Positions)

  • Purpose: Maintains an accurate record of all open perpetual and option positions for each user account and LP Vault.
  • Key State: Mappings of account => marketId => PositionPerp, account => optionSeriesId => PositionOption.
  • Key Functions: openPerpPosition(), closePerpPosition(), updatePerpPosition(), addOptionPosition(), removeOptionPosition(). Called internally by ClearingHouse.

OrderBookExecutor.sol (Processes Matched Trades from Off-Chain Engine)

  • Purpose: Securely receives batches of matched trades from the off-chain Matching Engine. Verifies the integrity and authorization of these batches (e.g., via signatures from trusted matching engine operators or consensus from a committee). Passes valid trades to ClearingHouse for settlement.
  • Key State: Nonces for replay protection, authorized matching engine addresses.
  • Key Functions: executeTradeBatch(trades[], signature).

FundingOracle.sol (Calculates & Stores Funding Rates)

  • Purpose: Calculates the funding rate for each perpetual market based on its premium/discount to the index price and the interest rate component. Stores historical funding rates.
  • Key State: Last funding timestamp, funding rate history for each market.
  • Key Functions: updateFundingRate(marketId, indexPrice, impactMidPrice), getFundingRate(marketId). Can be called by keepers or ClearingHouse.

PriceOracleAggregator.sol (Secure Price Feeds)

  • Purpose: Provides reliable and manipulation-resistant Index Prices for underlying assets (for perps and option settlement) and volatility data (for options risk management & pricing). Aggregates data from multiple independent, reputable oracle providers (e.g., Chainlink, Pyth, Band, plus RISEChain native oracles).
  • Key State: List of trusted oracle providers per asset, aggregation logic parameters.
  • Key Functions: getLatestPrice(assetId), getVolatility(assetId, optionTerm), getHistoricalPrice(assetId, timestamp).

InsuranceFund.sol

  • Purpose: Holds and manages the Insurance Fund.
  • Key State: Fund balance, list of approved collateral assets.
  • Key Functions: receiveLiquidationProceeds(), coverBankruptPosition(accountId, shortfallAmount), addFunds(), withdrawFundsByGovernance().

OptionsRegistry.sol (Manages Tradable Option Series)

  • Purpose: Allows governance to list new option series (underlying, type, strike, expiry). Manages the lifecycle of these series, including triggering expiry and settlement procedures.
  • Key State: List of all active and expired option series, their parameters.
  • Key Functions: listNewSeries(), triggerExpiry(seriesId), getSeriesDetails(seriesId).

LPVaultManager.sol (Manages LP Deposits, Withdrawals, Hedging Logic Interface)

  • Purpose: Handles user deposits into and withdrawals from specific options underwriting vaults. Stores vault configurations (strategy, authorized hedger bots). Provides an interface for Hedging Bots to report hedge executions and for the ClearingHouse to query vault risk parameters.
  • Key State: LP deposits per vault, vault strategies, LP token issuance.
  • Key Functions: depositToVault(), withdrawFromVault(), initiateUnderwrite(seriesId, amount), recordHedge(perpMarketId, size, price), getVaultNetRiskProfile(vaultId).

Governance.sol

  • Purpose: Allows token holders (or a designated council) to vote on protocol parameter changes, contract upgrades, listing new markets, managing the treasury, etc.
  • Key State: Proposal details, voting records, parameter values.
  • Key Functions: submitProposal(), voteOnProposal(), executeProposal().

Off-Chain Components

Matching Engine (Unified for Perps & Options)

  • Responsibilities:

    • Receive and validate incoming orders (limit, market, stop-loss, take-profit) for both perpetual swaps and options from users via the API Gateway.
    • Maintain separate, high-speed, in-memory Central Limit Order Books (CLOBs) for every tradable perpetual market and every listed option series. [ FUTURE THOUGHT MIGHT HOST IN ONCHAIN ]
    • Execute the matching algorithm to find compatible buy and sell orders. [ AVL TREES ]
    • Generate Trade structures for matched orders.
    • Batch matched trades and submit them securely to the on-chain OrderBookExecutor.sol for settlement.
    • Provide real-time order book snapshots and trade feeds to the API Gateway.
    • Handle order cancellations and modifications.
  • Order Types Supported:

    • Market Order: Executes immediately against the best available prices on the order book.
    • Limit Order: Placed at a specific price or better. Remains on the order book until filled, cancelled, or expired.
    • Stop-Loss Order (Triggered Market/Limit): Becomes a market or limit order when the market price reaches a specified stop price.
    • Take-Profit Order (Triggered Market/Limit): Similar to stop-loss, but triggered to lock in profits.
    • Fill-Or-Kill (FOK): Must be filled entirely immediately, or it's cancelled.
    • Immediate-Or-Cancel (IOC): Must be filled partially or entirely immediately; any unfilled portion is cancelled.
    • Post-Only: Ensures the order is only accepted if it would be a maker order (adds liquidity), otherwise it's rejected/cancelled.
  • Matching Algorithm: Typically Price/Time priority.

    • Orders at a better price get priority.
    • Orders at the same price get priority based on their arrival time (FIFO - First-In, First-Out).
    • Periodically (e.g., every few seconds or once a batch reaches a certain size) submits a batch of matched Trade objects.
  • Liquidation Bots

  • Price Feed Providers & Oracle Network Nodes

  • Indexers

  • LP Vault Hedging Bots


TO EXPLORE and more research

  • AMM for options trading ?
  • Money markets and spot Direct integration !!

APPENDIX